package com.yangle.frame.admin.controller;

import com.github.pagehelper.PageHelper;

import com.yangle.frame.admin.entity.FrameMenu;
import com.yangle.frame.admin.service.FrameMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by yangle on 2017/9/24.
 */
@Controller
public class LoginController {
@Autowired
private FrameMenuService frameMenuService;
    @RequestMapping("/login")
public String login(Model model, HttpServletRequest request,String error, String logout) {
    if (logout != null) {
        model.addAttribute("msg", "你已经成功退出");
    }
    return "login";
}
    @RequestMapping("/")
    public String index(HttpServletRequest request, HttpServletResponse response,Model model){
        //设置左侧菜单
        List<FrameMenu> leftMenu = frameMenuService.getLeftMenu();
        model.addAttribute("leftMenus",leftMenu);
        return "frame/index";

}
    @RequestMapping("/home")
    public String home(HttpServletRequest request, HttpServletResponse response,Model model){
        return "frame/home";
    }

}
